home *** CD-ROM | disk | FTP | other *** search
/ CYBER.XPO.95 / CYBER.XPO.95 (Arsenal Computer).ISO / popreq / amiga1 / dcdd_20.lha / DCDD.rexx < prev    next >
OS/2 REXX Batch file  |  1994-01-27  |  23KB  |  829 lines

  1. /*
  2.   DCDD.rexx                                                      940127.2331
  3.  
  4.  
  5.  
  6.                  DIRECT_CONNECT_DEMON DIALER  -  Version 2.0  
  7.  
  8.  
  9.   Use with Arexx Version 1.1 or better, BaudBandit 1.5 or better.
  10.   
  11.   Jerry Smith - Fresno, CA.             Contact BBS: F.A.A.X. (209) 226-7162
  12.  
  13.               Not copyrighted, fully in the public domain.
  14.       Various bits and pieces lifted from other PD ARexx programs.
  15.  
  16.   I would like to give special thanks to the following people:
  17.  
  18.     Dave Mullenix for his GREAT series of ARexx programs for dialing PC 
  19.     Pursuit. (Many of who's ideas are incorporated here)
  20.  
  21.     Darcy McConnell for the use of his BBS for tests, tests, tests, etc....
  22.  
  23.     Richard Stockton for his help with Arexx and BaudBandit.
  24.  
  25.     My Wife and Best Friend (Diane) for her help, warmth and understanding.
  26.  
  27. */
  28.  
  29. OPTIONS RESULTS
  30.  
  31. address BAUD 
  32.  
  33. parse arg filename
  34.  
  35. TRUE = (1=1)
  36. FALSE = ~ TRUE
  37. EXIT_TIMER = 0
  38. SPACER = ' '
  39.  
  40. if filename = '' then
  41.   DCDDPhone="DCDD"
  42. else
  43.   DCDDPhone=filename
  44.  
  45.  
  46. /* SHIFT F10 will stop this script before the next BBS is dialed
  47.              or break you out of a "stuck BBS"                    */
  48.  
  49. FKEY 'S10 \Mzap.continue.rexx' 
  50.  
  51. /*  GENERAL BAUDBANDIT SETTINGS BELOW                             */
  52.  
  53. mask on      /* turns on mask */
  54.  
  55. /* mask off                   */
  56.  
  57. /* ansi on */ 
  58.  
  59. /* ansi off */ 
  60.  
  61. set F     /* blanks screen w/form feed                            */  
  62.  
  63. set 8N1   /* set modem to 8N1                                     */  
  64.  
  65. set A     /* set default to Z modem (auto DL)                     */
  66.  
  67. Auto OFF  /* turn Auto_PhoneBook OFF                              */
  68.  
  69. Popup OFF /* You MUST have this in your default config or else have the
  70.              Phone Book screen getting in you way. (see DCDD.doc) */
  71.  
  72. screen off  /* allows CON screen to come to the front */
  73.  
  74.  
  75. Data 'RAM:-DL'  /* set up default download area for downloaded files */
  76.  
  77.  
  78.                     /* * * * * * * * * * * * * * * * * * * * 
  79.                       * * *  Open a full sized window * * *
  80.                      * * * * * * * * * * * * * * * * * * * */
  81.  
  82.  
  83. windev = "CON:1/11/640/189/ Direct Connect Demon Dialer . . . . . . . . . . . . phonebook "DCDDPhone
  84.  
  85. if ~open('wind',windev) then exit      /* Window for all activity */
  86.  
  87. NoError = 0
  88. NoTimeout = 0
  89.  
  90. maxnumbers = 80  /* maximum number of entries in phonebook */
  91.  
  92. call J_Date /* creates JDATE for testing against julian date in 
  93.                phonebook for transfer to GUI selection screen */
  94.   
  95. call ReadPhoneBk
  96. call GetTotTime
  97.  
  98. temp= 'Hours used in' date(m)':' right(thours,2,'0')':'right(tmins,2,'0')':'right(tsecs,2,'0')
  99. call wsaych(temp)
  100. call wsay('  Select BBS(s):')
  101.  
  102. BBSelections = readln('wind')
  103.  
  104. screen on  /* turns BaudBandit screen on */
  105. send '\U'  /* brings BaudBandit screen to the front - here and now! 
  106.               The one in the main loop will bring the screen to the front
  107.               when a BBS is connected. */
  108.  
  109.  
  110. /* below allows you to enter an "A" as the first character in your BBSelections
  111.    to activate the AUTO function in Do_WHOEVER.rexx scripts. 
  112.  
  113.    Please note that you can not mix AUTO and MANUAL selections in the same 
  114.    session. I may change this if enough people ask for it. 
  115.  
  116.    See Do_FAAX.rexx for an example..... */
  117.  
  118. parse var BBSelections AUTO 2 .     
  119.  
  120. if upper(AUTO) = 'A' then do
  121.    address command 'makedir RAM:AUTO'
  122.    msg '********** -------------------- **********'
  123.    msg '********** AUTO PROCESS STARTED **********'
  124.    msg '********** -------------------- **********'
  125.    call delay(100)
  126.    end
  127.  
  128. /* below allows BBS number(s) separated by ,./;:\|+-*# or space(s) */
  129. y=translate(BBSelections,' ',',Aa./;:\|=+_*#') 
  130.  
  131. bbs2call=0
  132. do i = 1 to bbsnums
  133.   parse var y first y
  134.   bbs2call=bbs2call+1
  135.   bbs.i = first
  136.   if first == '' then leave  /* breaks out of DO FOREVER loop */
  137. end
  138.  
  139. bbs2call=bbs2call-1
  140. msg ' '
  141. msg bbs2call 'Selected BBSes to be Called'
  142. msg_x_flag = ' '
  143.  
  144. do z=1 to bbs2call
  145.   t=bbs.z
  146.   msg_x = ' '
  147.   do    /* below tests for AREXX SCRIPT in BBS for AUTO process */
  148.      if UPPER(AUTO) = 'A' then do 
  149.         if bbs.t.script = ' ' then do
  150.            msg_x = '****** MISSING AREXX SCRIPT ******'
  151.            msg_x_flag = 'bad'
  152.         end
  153.      end
  154.   end 
  155.   msg z':' bbs.t.name '  ' msg_x
  156. end 
  157.  
  158. if msg_x_flag = 'bad' then do
  159.    bbs2call = 0
  160.    msg ' '
  161.    msg ' '
  162.    msg '****** AUTO PROCESS ERROR - MISSING AREXX SCRIPT ******'
  163.    msg ' '
  164.    msg '10'
  165.    call delay(50)
  166.    msg '  9'
  167.    call delay(50)
  168.    msg '    8'
  169.    call delay(50)
  170.    msg '       7'
  171.    call delay(50)
  172.    msg '           6'
  173.    call delay(50)
  174.    msg '                5'
  175.    call delay(50)
  176.    msg '                       4'
  177.    call delay(50)
  178.    msg '                                3'
  179.    call delay(50)
  180.    msg '                                           2'
  181.    call delay(50)
  182.    msg '                                                          1'
  183.    call delay(50)
  184. end 
  185.  
  186.  
  187. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  188.  *                                                               *
  189.  *                          Main Loop                            *
  190.  *                                                               *
  191.  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  192.  
  193.  
  194. listindex=1 ;
  195. do while bbs2call ~= 0                                        
  196.  
  197.   indx = bbs.listindex
  198.  
  199.   call CONTINUE_TEST
  200.   
  201.   msg ''
  202.   if upper(AUTO) = 'A' then 
  203.      msg 'AUTO >> Dialing:' bbs.indx.name  
  204.   else
  205.      msg 'Dialing:' bbs.indx.name 
  206.  
  207.   bbsconnect = false
  208.   nresult = ' '
  209.  
  210.   call at_codes  /* send AT codes to modem for selected BBS. This is VERY
  211.                     useful when using a SupraFAXmodem V32.bis at 14.4 */ 
  212.  
  213.      if CallBBS(bbs.indx.phone) = NoTimeout then do      
  214.        if pos('CARRIER',nresult) = 1 then do                 
  215.  
  216.          call time(R) 
  217.  
  218.          dateYYYYMM=left(date(sorted),6)               
  219.          dateYYMMDD=right(date(sorted),6)              
  220.          timea=translate(time(n),' ',':')              
  221.          parse value timea with timeHH timeMM timeSS .  
  222.          timeHHMM=timeHH||timeMM 
  223.  
  224.          beep 
  225.  
  226.   send '\u' /* (pull screen to front when bbs connected) 
  227.                You may or may not want to use this here. */
  228.  
  229.   parse var bbs.indx.captitle CT PW1 PW2 LD TM MN SPD JDATE .
  230.  
  231. /* Capt "RAM:-dl below puts all Capture Logs in to this dir */
  232.  
  233.           if CT ~= '' then                
  234.             Capt 'RAM:-dl/'CT'.'dateYYMMDD'.'timeHHMM'.1'    
  235.  
  236.  /* above gives you files like OLD_DOC.930719.1718.1 - Had to add time so
  237.     that files opened up on RAM:-dl would not duplicate files in DH1:-dl 
  238.     when they are transfered after logging out of a BBS. Really do need to
  239.     download into RAM when doing V32.bis 14.4 with a 68000 native CPU. */
  240.  
  241.           if bbs.indx.script ~= '' then do                    
  242.             parse var bbs.indx.script title Xargs
  243.             msg 'Starting Arexx Script: ' title
  244.  
  245.             if PW1 = ' ' then PW1 = 'NO_PW_1'
  246.             if PW2 = ' ' then PW2 = 'NO_PW_2'
  247.  
  248.             if Xargs = ' ' then Xargs = ' NO_Xargs'
  249.             OUTargs = title||"("PW1||spacer||PW2||Xargs||")"
  250.  
  251. /* jws
  252. msg '****************************************'
  253. msg 'DCDD.rexx OUTargs = ' OUTargs
  254. msg '****************************************'
  255.  
  256.   call delay(600) 
  257. */
  258.  
  259.             interpret 'call' OUTargs
  260.           end                                                 
  261.  
  262.           call DoPairs
  263.  
  264.           call wait4disconnect
  265.  
  266.           Capture OFF  
  267.           
  268. /* items below copy ALL data in RAM:-dl to DH1:-dl 
  269.          and then clears RAM:-dl for the next BBS called.
  270.  
  271.    At the end of a days BBSing I create a file called DH1:-dl-YYMMDD
  272.       and copy the contents of DH1:-dl into it and then clear DH1:-dl
  273.       for the next days activity. */
  274.  
  275. /* BE SURE DH1: has room for the files you DL!!!!!!!!!!!!!!!!! */
  276.  
  277.           address command 'copy RAM:-dl/#? DH1:-dl'
  278.           address command 'delete RAM:-dl/#?'
  279.  
  280.           call removebbs /* remove bbs from selection group */
  281.  
  282.         end
  283.  
  284.         send '\d'   /* drop DTR */
  285.         send '\ah'  /* hangs up modem */
  286.  
  287.         call selectnextbbs /* select next bbs from selection group */
  288.  
  289.         end                                                       
  290.  
  291.   call CONTINUE_TEST  /* test for ram:continue as flag to continue or quit*/
  292.  
  293.   if listindex > bbs2call then 
  294.      listindex = 1
  295.  
  296. end
  297.  
  298. /* next two lines force DCDD.rexx to quit */
  299.  
  300. address command 'delete RAM:continue'    
  301. call CONTINUE_TEST    
  302.  
  303. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  304.  *                                                             *
  305.  *                   Functions / Subroutines                   *
  306.  *                                                             *
  307.  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  308.  
  309.  
  310. Continue_Test:
  311.  
  312. /* tests for RAM:continue as flag to continue or quit */
  313.  
  314. if exists('ram:continue')=0 then do
  315.    call delay(50)
  316.    msg ' '
  317.    msg ' '        
  318.    msg '**************************************************'
  319.    msg '*****                                       ******'
  320.    msg '***** EXITING * DIRECT CONNECT DEMON DIALER ******'
  321.    msg '*****                                       ******'
  322.    msg '**************************************************'
  323.    capture OFF  
  324.    call close('wind')
  325.    send '\d'   /* drop DTR */
  326.    send '\ah'  /* hangs up modem */
  327.    send '\aq'  /* closes BaudBandit  */
  328.    exit        /* exits Arexx        */
  329.    end
  330. else do
  331.    call delay(10)
  332.    beep
  333.    call delay(10)
  334.    beep
  335.    end
  336. return
  337.  
  338.  
  339. AT_codes:
  340.  
  341. /* sends special AT codes for currently selected BBS to modem */
  342.  
  343.    send 'AT&F2'  /* resets modem to factory settings          */
  344.    send '\w\r' 
  345.    send 'AT&F2'  /* resets modem to factory settings 2nd time */
  346.    send '\w\r'   /* don't know why it needs it but it do!     */ 
  347.  
  348. /* W1 below is necessary to set the CARRIER option so that the
  349.       baud rate at connect is captured.  */
  350.  
  351.   if bbs.indx.atcodes ~= '' then do 
  352.     send 'AT W1 'bbs.indx.atcodes
  353.     send '\w\r'
  354.     msg 'AT codes sent to modem - ' bbs.indx.atcodes
  355.     end
  356.   else do
  357.     send 'AT M W1'   /* M = speaker off, W1 = carrier - etc. */
  358.     send '\w\r' 
  359.     end
  360. return
  361.  
  362.  
  363. Wsay:
  364.  
  365. /* put string to window with EOL */
  366.  
  367.   parse arg strx   
  368.   call writeln('wind',strx)
  369. return
  370.  
  371.          
  372. WsayCH:
  373.   
  374. /* put string to window without EOL */
  375.  
  376.   parse arg strx   
  377.   call writech('wind',strx)
  378. return
  379.  
  380.          
  381. DoPairs:
  382.  
  383. /* Have BaudBandit execute script pairs just like in Phonebook */
  384.  
  385. /* Some BBS software needs an ESCAPE key (or two) to load and this can be
  386.    taken care of using a Script Pair that starts like:
  387.  
  388.    {Escape twice=\w\x1B\w\x1B\w\r}{....then your remaining stuff....
  389.  
  390. */
  391.  
  392.  if bbs.indx.pair ~= '' then do /* Do optional pairs after connect */
  393.     address BAUD 
  394.     pairs bbs.indx.pair
  395.  end 
  396.  
  397. return
  398.  
  399.  
  400. wait4disconnect:
  401.  
  402. if bbs.indx.script = '' then do                    
  403.   msg ''
  404.   msg '+--------------------------------------+'
  405.   msg '  WAITING FOR 'bbs.indx.name' DISCONNECT '
  406.   msg '+--------------------------------------+'
  407. end
  408.  
  409.   call delay(150) 
  410.  
  411.   do forever
  412.      ADDRESS BAUD
  413.      dcd
  414.  
  415. /*   note: RTEST holds RC value as RC resets after every Arexx command
  416.            is executed. */
  417.  
  418.      RTEST = RC
  419.      if RTEST = 0 then leave  /* breaks out of DO FOREVER loop */
  420.      call delay(250)  /* 5 second delay for FOREVER loop */
  421.  
  422. /* below uses shift F10 to get out of a "STUCK BBS". 
  423.    this routine also used for Arexx Script failed WAIT LOOP exiting.
  424.    Please note that this does NOT end the session just current BBS. */
  425.  
  426.       if exists('ram:continue')=0 then do
  427.          msg '****** FORCED BBS LOGOFF BY USER ******'
  428.          address command 'makedir ram:continue'
  429.          call delay(50) 
  430.          leave    /* breaks out of DO FOREVER loop */
  431.       end
  432.  
  433. /* NOTE: process below replaced by NESTED DO FOREVER/WAIT LOOPS 
  434.          see Do_FAAX.rexx for an example... */
  435.  
  436. /* below uses RAM:exit_flag to get out of a "STUCK BBS" when 
  437.    you are using Arexx scripts for Auto late nite sessions
  438.    and want to be sure of exiting a BBS if they have changed
  439.    things and your script gets "HUNG UP". The EXIT_TIMER will
  440.    be reset to zero if RAM:exit_flag is absent.  */
  441.  
  442.      if exists('ram:exit_flag')=0 then do 
  443.         exit_timer = 0
  444.         end
  445.      else do  
  446.         exit_timer = exit_timer + 5
  447.         if exit_timer > 300 then do 
  448.            msg '****** FORCED LOGOFF BY EXIT_TIMER ******'
  449.            call delay(50) 
  450.            address command 'delete ram:EXIT_TIMER'
  451.            leave     /* breaks out of DO FOREVER loop */
  452.            end
  453.         end
  454.  
  455.   end
  456.  
  457. /*
  458.     below is old OLD way of holding till logged off BBS.
  459.     it had a "BIG" problem with matching text during DL's.
  460.  
  461.     wait 'NO CARRIER'
  462. */
  463.  
  464. /* Get connection elapsed time from Arexx timer */
  465.  
  466.   timeE=(time(e)) 
  467.   chours = timeE % 3600
  468.   choursrem = timeE // 3600
  469.   cmins = choursrem % 60
  470.   csecsx = choursrem // 60
  471.   csecs = csecsx % 1
  472.   cTOTAL = right(chours,2,'0')':'right(cmins,2,'0')':'right(csecs,2,'0')
  473.  
  474.   msg 'Updating Total Time'
  475.   discotitle='DCDDdiscos.'dateYYYYMM   
  476.   if open('discos',discotitle,'Append') = 0 then  /* append if exists */
  477.      call open('discos',discotitle,'Write')       /* else create file */
  478.  
  479.   temp = dateYYMMDD timeHHMM cTOTAL CT SPEED bbs.indx.name  
  480.   call writeln('discos',temp)
  481.   call close('discos')
  482.  
  483. /* 
  484.    History file added so that this file will (when sorted) give you a
  485.    complete log of sessions on a BBS by BBS basis.   
  486. */
  487.  
  488.   htitle='DCDDhistory'   
  489.   if open('hist',htitle,'Append') = 0 then  /* append if exists */
  490.      call open('hist',htitle,'Write')       /* else create file */
  491.  
  492.   htemp = CT dateYYMMDD timeHHMM cTOTAL SPEED bbs.indx.name 
  493.   call writeln('hist',htemp)
  494.   call close('hist')
  495.    
  496. /* 
  497.    below reads in the Bandit.'DCDDPhone' file and re-writes it out to 
  498.    ram:Bandit.'DCDDPhone'. During this process the bbs.j.captitle record
  499.    is updated for the BBS just visited for BBS activity tracking. This
  500.    will be used at the next session to display information on the BBS
  501.    selection screen so that you know how long ago you visited that BBS.
  502.  
  503.    this process also updates the Bandit.'DCDDPhone' bbs.j.captitle record
  504.    for all BBSes with blank fields.
  505. */
  506.  
  507.   call open('in1A','Bandit.'DCDDPhone,'r')
  508.   call open('out1A','ram:Bandit.'DCDDPhone,'W')
  509.  
  510.   call J_DATE  /* used to get JDATE at logoff point in BBS session */
  511.  
  512. /* Read BBS PhoneBook records */
  513.   do until EOF('in1A')
  514.     inline1A=readln('in1A')
  515.     if ~ EOF('in1A') then do
  516.       parse var inline1A DASHES 6 .
  517.       if DASHES = '-----' then
  518.         line_cnt = 0
  519.       line_cnt = line_cnt + 1
  520.       if line_cnt = 6 then do
  521.         parse var inline1A CTN PW1N PW2N LDN TMN MNN SPDN JDATEN .
  522.         if PW1N   = ' ' then PW1N   = 'NO_PW_1'
  523.         if PW2N   = ' ' then PW2N   = 'NO_PW_2'
  524.         if LDN    = ' ' then LDN    = 0
  525.         if TMN    = ' ' then TMN    = 0
  526.         if MNN    = ' ' then MNN    = 0
  527.         if SPDN   = ' ' then SPDN   = 0
  528.         if JDATEN = ' ' then JDATEN = JDATE - 1000 
  529.         if CTN = CT then do 
  530.           inline1A = CTN PW1N PW2N dateYYYYMMDD timeHHMM cTOTAL SPEED JDATE
  531.           end
  532.         else do
  533.           inline1A = CTN PW1N PW2N LDN TMN MNN SPDN JDATEN
  534.           end
  535.       end /* end for (if line_cnt = 6) */  
  536.       call writeln('out1A', inline1A)
  537.     end /* end for (if ~ EOF) */
  538.   end /* end for (do until EOF) */  
  539.   call close('in1A')
  540.   call close('out1A')
  541.  
  542. /* below copies temporary file from ram back over Bandit.'DCDDPhone' file
  543.    and then deletes it in ram. */
  544.  
  545.   address command 'copy ram:Bandit.#? dh0:DemonDialer'
  546.   address command 'delete ram:Bandit.#?'
  547.  
  548.   timetitle='DCDDtime.'dateYYYYMM                
  549.  
  550.   if open('TotTime',timetitle,'R')=0 then do /* Total hours, mins, secs */
  551.      thours = 0
  552.      tmins = 0                     /* If file doesn't exist, set to zero */
  553.      tsecs = 0
  554.      end
  555.   else do
  556.      thours=readln('TotTime')      /* If file does exist, read them */
  557.      tmins=readln('TotTime')
  558.      tsecs=readln('TotTime')
  559.      call close('TotTime')
  560.      end
  561.  
  562.   msg 'Monthly total:' right(thours,2,'0')':'right(tmins,2,'0')':'right(tsecs,2,'0')
  563.   msg '    This call:' cTOTAL
  564.   nhours = chours+thours
  565.  
  566.   if csecs > 0 then do  /* the Damn phone company rounds  */ 
  567.      cmins = cmins + 1  /* any seconds into a full minute */
  568.      csecs = 0        
  569.   end
  570.     
  571.   nmins = cmins+tmins
  572.   nsecs = csecs+tsecs
  573.  
  574.   nmins=nmins+nsecs%60 ; nsecs = nsecs//60
  575.   nhours=nhours+nmins%60 ; nmins = nmins//60
  576.  
  577. /* If bbs.indx.local = LOCAL do not update TotTime */
  578.  
  579.   parse var bbs.indx.local LFLAG 6 .     
  580.  
  581. /*  if bbs.indx.local = '' then do */ 
  582.  
  583.   if LFLAG ~ = 'LOCAL' then do 
  584.  
  585.      call open('TotTime',timetitle,'W')
  586.      call writeln('TotTime', nhours)
  587.      call writeln('TotTime', nmins)
  588.      call writeln('TotTime', nsecs)
  589.      call close('TotTime')
  590.      msg '               --------'
  591.      msg '    New Total:' right(nhours,2,'0')':'right(nmins,2,'0')':'right(nsecs,2,'0')
  592.      end
  593.   else do
  594.     msg 'Local BBS - TotTime not updated'
  595.     end
  596.  
  597. return
  598.  
  599.  
  600. removebbs:    
  601.  
  602. /* Done with that bbs, change ALL occurances to "called" in selection group */
  603.  
  604.   do j = 1 to bbs2call                  
  605.      if bbs.j = indx then do
  606.         bbs.j = 'called'
  607.      end                     
  608.   end                                   
  609.  
  610. return
  611.  
  612.  
  613. selectnextbbs:    
  614.  
  615. /* Select the next available BBS from selection group */
  616.  
  617.   yet2call = 0
  618.   wascalled = 0
  619.  
  620.   do k = 1 to bbs2call                         
  621.      if bbs.k = 'called' then do        
  622.         wascalled = wascalled + 1
  623.      end                                
  624.      else do                     
  625.         yet2call = yet2call + 1
  626.      end                         
  627.   end                                          
  628.  
  629.   if yet2call = 0 then do              
  630.      bbs2call = 0  
  631.      end                                  
  632.   else do                       
  633.  
  634.      loopcount = 0 
  635.  
  636.         do forever                           
  637.  
  638.         listindex=listindex + 1
  639.  
  640.         if listindex > bbs2call then        
  641.            listindex = 1
  642.            loopcount = loopcount + 1
  643.  
  644.         if bbs.listindex ~= 'called' then
  645.            leave   /* breaks out of DO FOREVER loop */
  646.  
  647.  
  648.         if loopcount > 2 then do  
  649.            msg '****** loopcount > 2 ******'
  650.            bbs2call = 0
  651.            leave   /* breaks out of DO FOREVER loop */
  652.  
  653.         end                       
  654.  
  655.      end                                          
  656.  
  657.      livecount = 0
  658.  
  659.      if yet2call ~= 0 or exists('ram:continue')=0 then do              
  660.         msg ' ' 
  661.         msg yet2call ' BBSes yet to be called'
  662.         do z=1 to bbs2call                            
  663.            t=bbs.z
  664.            if bbs.z ~= 'called' then do       
  665.               livecount = livecount + 1
  666.               msg livecount ':' bbs.t.name
  667.            end                                
  668.         end
  669.       end                                           
  670.   end                           
  671.  
  672. return
  673.  
  674.  
  675. CallBBS:
  676.  
  677. /* Dial Selected BBS */
  678.  
  679.   arg number
  680.   call delay(25)
  681.   timeout 120     /* wait continues if no connectstring within 2 minutes */
  682.   send 'ATDT'number'\r'
  683.   call shownotes
  684.   connectstring='CARRIER 14400,CARRIER 12000,CARRIER 9600,CARRIER 7200,CARRIER 2400,BUSY,OK,NO CARRIER,NO DIALTONE'
  685.   wait connectstring
  686.   NRC = RC
  687.   NRESULT = RESULT  
  688.   parse value NRESULT with AAA SPEED .
  689.  
  690. /* SPEED above used to capture arbitated carrier connect speed */
  691.  
  692. return NRC
  693.  
  694.  
  695. shownotes:
  696.  
  697. /* Show BBS notes if present */
  698.  
  699.   if bbs.indx.notenum > 0 then do     
  700.     msg 'Notes for' bbs.indx.name':'
  701.     do notex = 1 to bbs.indx.notenum
  702.       msg bbs.indx.notes.notex
  703.     end
  704.   end
  705.  
  706.   else do
  707.      msg 'No notes for' bbs.indx.name
  708.   end
  709.   msg ' '
  710. return
  711.  
  712.  
  713. GetTotTime:
  714.  
  715. /* gets total time for the month */
  716.  
  717.   timetitle='DCDDtime.'left(date('S'),6)             /* DCDDtime.YYYYMM */
  718.   if open('TotTime',timetitle,'R')=0 then do /* Total hours, mins, secs */
  719.     thours = 0
  720.     tmins = 0                     /* If file doesn't exist, set to zero */
  721.     tsecs = 0
  722.   end
  723.  
  724.   else do
  725.     thours=readln('TotTime')      /* If file does exist, read them */
  726.     tmins=readln('TotTime')
  727.     tsecs=readln('TotTime')
  728.     call close('TotTime')
  729.   end
  730. return
  731.  
  732. J_DATE:
  733.  
  734. dateYYYYMMDD = left(date(sorted),8)
  735. parse var dateYYYYMMDD J_YYYY 5 J_MM 7 J_DD 9 .
  736. if J_MM = 01 then JDATE = (J_YYYY * 365) + 000 + J_DD
  737. if J_MM = 02 then JDATE = (J_YYYY * 365) + 031 + J_DD
  738. if J_MM = 03 then JDATE = (J_YYYY * 365) + 059 + J_DD
  739. if J_MM = 04 then JDATE = (J_YYYY * 365) + 090 + J_DD
  740. if J_MM = 05 then JDATE = (J_YYYY * 365) + 120 + J_DD
  741. if J_MM = 06 then JDATE = (J_YYYY * 365) + 151 + J_DD
  742. if J_MM = 07 then JDATE = (J_YYYY * 365) + 181 + J_DD
  743. if J_MM = 08 then JDATE = (J_YYYY * 365) + 212 + J_DD
  744. if J_MM = 09 then JDATE = (J_YYYY * 365) + 243 + J_DD
  745. if J_MM = 10 then JDATE = (J_YYYY * 365) + 273 + J_DD
  746. if J_MM = 11 then JDATE = (J_YYYY * 365) + 304 + J_DD
  747. if J_MM = 12 then JDATE = (J_YYYY * 365) + 334 + J_DD
  748. if J_YYYY//4 = 0 then do
  749.   if J_MM > 2 then do
  750.     JDATE = JDATE + 1
  751.     end
  752.   end
  753. return
  754.  
  755. ReadPhoneBk:
  756.  
  757. /* Read Phone Book into Arexx array */
  758.  
  759. call open('PhoDir','Bandit.'DCDDPhone,'r')
  760.  
  761. bbsnums = 0                            /* Read BBS records */
  762. inline1=readln('PhoDir')
  763. do j=1 to maxnumbers until eof('PhoDir')
  764.   bbsnums = bbsnums + 1
  765.   bbs.j.name=strip(readln('PhoDir'))
  766.   bbs.j.phone=strip(readln('PhoDir'))
  767.   bbs.j.local=strip(readln('PhoDir'))
  768.   bbs.j.atcodes=strip(readln('PhoDir'))
  769.   bbs.j.captitle=strip(readln('PhoDir'))
  770.   bbs.j.script=strip(readln('PhoDir'))
  771.   bbs.j.pair=strip(readln('PhoDir'))
  772.  
  773.   /* Read optional notes */
  774.   notex=0 ; inline1=''
  775.   do until inline1 = '-----' | EOF('PhoDir')
  776.     inline1=readln('PhoDir')
  777.     if inline1 ~= '-----' then do
  778.       notex = notex + 1
  779.       bbs.j.notes.notex = inline1
  780.     end
  781.   end
  782.   bbs.j.notenum = notex
  783.  
  784.   /* Print BBS name */
  785.  
  786.   parse var bbs.j.captitle CTN PW1N PW2N LDN TMN MNN SPDN JDATEN .
  787.  
  788. /* jws
  789.   if PW1N   = ' ' then PW1N   = 'NO_PW_1'
  790.   if PW2N   = ' ' then PW2N   = 'NO_PW_2'
  791.   if LDN    = ' ' then LDN    = 0
  792.   if TMN    = ' ' then TMN    = 0
  793.   if MNN    = ' ' then MNN    = 0
  794.   if SPDN   = ' ' then SPDN   = 0
  795. */
  796.  
  797. /* JDATE (below) is from initilization point at start of this session */
  798.  
  799.   if JDATEN = ' ' then JDATEN = JDATE - 1000 
  800.  
  801.   JDIFF = JDATE - JDATEN
  802.   JX = '.'
  803.   if jdiff > 030 then JX = '-'
  804.   if jdiff > 060 then JX = '='
  805.   if jdiff > 090 then JX = 'x'
  806.   if jdiff > 365 then JX = '*'
  807.  
  808.   if j//4 ~= 0 then do /* allows four across on CON window */
  809.  
  810. /*
  811.    I use bbs.j.captitle instead of bbs.j.name below because all my files 
  812.    use the same name as my discos and capture files and I only have to 
  813.    remember one name. The FULL name is used when you connect to a BBS
  814. */
  815.  
  816.  
  817.     call wsaych(right(j,2,' ') JX left(CTN,14,' '))
  818.     end
  819.   else
  820.     call wsay(right(j,3,' ') JX left(CTN,14,' '))
  821. end  
  822. call close('PhoDir')
  823.  
  824. bbsnums=bbsnums-1
  825. if bbsnums//2 = 0 then 
  826.   call wsay('')
  827. return
  828.  
  829.